package com.project.util;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

final public class HibernateUtil {
	/**
	 * 
	 * @param date
	 * @return next Month
	 */

	public static Calendar getDateOfNextMonth(Date date) {
		Calendar nextDate = Calendar.getInstance();
		nextDate.setTime(date);
		nextDate.add(Calendar.MONTH, 1);
		// nextDate.getT
		return nextDate;
	}

	public static Date getDateofNextDay(Date date) {
		Calendar calendar = new GregorianCalendar();
		calendar.setTime(date);
		calendar.add(Calendar.DATE, 40);
		date = calendar.getTime();
		return date;
	}

	public static int getIntervalDays(Date begindate, Date enddate) {
		long millisecond = enddate.getTime() - begindate.getTime();
		int day = (int) (millisecond / 24L / 60L / 60L / 1000L);
		return day;
	}
}
